home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / screen32.lha / screen-3.2b / terminfo / getwinsize.c next >
C/C++ Source or Header  |  1991-10-19  |  768b  |  34 lines

  1. main()
  2. {
  3.   char *term, *s;
  4.   int li, co;
  5.   char tbuf[1024];
  6.  
  7.   term = (char *)getenv("TERM");
  8.   printf("under iScreen getenv(\"TERM\") should return \"screen\": %s\n", term);
  9.   printf("getenv(\"LINES\") returns ");
  10.   if (s = (char *)getenv("LINES"))
  11.     {
  12.       li = atoi(s);
  13.       printf("%d\n", li);
  14.     }
  15.   else
  16.     printf("nothing valuable\n");
  17.   printf("getenv(\"COLUMNS\") returns ");
  18.   if (s = (char *)getenv("COLUMNS"))
  19.     {
  20.       co = atoi(s);
  21.       printf("%d\n", co);
  22.     }
  23.   else
  24.     printf("nothing valuable\n");
  25.   if (tgetent(tbuf, term) != 1)
  26.     {
  27.       printf("Oh, no termcap/info entry for %s!\n", term);
  28.     }
  29.   li = tgetnum("li");
  30.   printf("tgetnum(\"li\") returns %d\n", li);
  31.   co = tgetnum("co");
  32.   printf("tgetnum(\"co\") returns %d\n", co);
  33. }
  34.